From: Sebastian Keller Date: Mon, 14 Sep 2026 02:00:50 +0000 (+0200) Subject: popupMenu: Fix submenu signal connector leak X-Git-Tag: archive/raspbian/50.5-1+rpi1^2~6^2^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=14dc41d85593dbba361d9302a320c4078450b73f;p=gnome-shell.git popupMenu: Fix submenu signal connector leak Neither `PopupMenuBase` nor the `PopupSubMenu` that is used as `menu` of `PopupSubMenuMenuItem` is destroyable, so the connection needs to be manually disconnected when the `PopupSubMenu` is destroyed, otherwise the signal tracker and with it the `PopupSubMenu` is being leaked. Part-of: (cherry picked from commit 4a0d2e424a4b37ab6264e871a92044c8b83cc5fe) --- diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 7dce5b661..3ab4a9ee4 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -902,8 +902,10 @@ export class PopupMenuBase extends Signals.EventEmitter { this.box.insert_child_below(menuItem.menu.actor, beforeItem); this._connectItemSignals(menuItem); - menuItem.menu.connectObject('active-changed', - this._subMenuActiveChanged.bind(this), this); + menuItem.menu.connectObject( + 'active-changed', this._subMenuActiveChanged.bind(this), + 'destroy', () => menuItem.menu.disconnectObject(this), + this); this.connectObject('menu-closed', () => { menuItem.menu.close(BoxPointer.PopupAnimation.NONE); }, menuItem);